package com.bj.zspace.project.reactor.netty.tcp;

import reactor.core.publisher.Mono;
import reactor.netty.Connection;
import reactor.netty.tcp.TcpClient;

public class TcpClientTest {

    public static void main(String[] args) {

        Connection connection = TcpClient.create().host("localhost").port(8080).connectNow();

        connection.inbound().receive().then().subscribe(System.out::println);

        connection.outbound().sendString(Mono.just("hello world")).then().subscribe();
        connection.outbound().sendString(Mono.just("hello world 1")).then().subscribe(null, null, connection::dispose);



        connection.onDispose().block();

    }

}
